#pragma once
#include <stdio.h>
#include <String>
#include <SDL\SDL.h>
#include <SDL\SDL_image.h>
#include "GlobalStructs.h"
using namespace std;

//Tile Piece
// - possibly have quadrants or RECTS for placement of the arrows
// - [4] exits (on or off) (possibly make a check to make sure it is less than 4)
//    - are made accessible via click (RECT make)
//  
//Special Tile Abilities
// - tile piece as a TYPE flag (ie normal, start, destroy, harp, etc)
// - during logic update, tile abilities are processed depending on player action

//enum arrowDirection{
//	UP=0x01, RIGHT=0x02, DOWN=0x04, LEFT=0x08
//};

//enum arrowDirection{
//	UP, RIGHT, DOWN, LEFT, ROW = 5
//};
class Tile
{
private:
	int m_tileFlag;
	Position m_bgNum;
	bool m_arrowList[4];
	string m_name;
	SDL_Surface * m_tileBkgd;
	SDL_Surface * m_tileSprites;
	//unsigned m_arrowList;


public:
	// Constructors and Deconstructor
	Tile(void);
	Tile(int a_tileFlag, string a_name, Position a_bgNum);
	~Tile(void);

	// Set functions
	void setFlag(int a_tileFlag);
	void setName(string a_tileName);
	void setFlagAndName(int a_tileFlag, string a_name);
	void setExit(arrowDirection);
	void removeExit(arrowDirection);
	void rotateCW(void);
	void rotateCCW(void);
	
	// Get functions
	int getFlag(void);
	string getName(void);
	bool hasExit(arrowDirection);
	string toString();
	// DEBUG
	SDL_Surface* loadTileImage(string);

	// Draw functions
	SDL_Surface* drawBackground(SDL_Surface* a_dest, SDL_Surface* a_source);
	SDL_Surface* drawIcon(SDL_Surface* a_dest, SDL_Surface* a_source, Position a_idArray[]);
	SDL_Surface* drawExits(SDL_Surface* a_dest, SDL_Surface* a_source);
	SDL_Surface* getTileSurface(SDL_Surface * a_buffer, SDL_Surface * a_sourceBG, SDL_Surface * a_sourceTile, Position a_idArray[]);
};